<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" 
    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml"
	xmlns:ui="http://java.sun.com/jsf/facelets"
	xmlns:h="http://java.sun.com/jsf/html"
	xmlns:f="http://java.sun.com/jsf/core"
	xmlns:p="http://primefaces.org/ui">

<ui:composition template="/WEB-INF/templates/BasicTemplate.xhtml">

	<ui:define name="content">
		<f:event type="preRenderView" listener="#{recruiterController.beforeAdd}" />
		<div class="title ui-widget-header ui-corner-all">
			<h:panelGrid style="margin:auto;">
		AGREGAR RECLUTADOR
		</h:panelGrid>

		</div>
		<h:form id="formAdd">
			<h:panelGrid style="margin:auto;">

				<h:panelGrid style="margin:auto;text-align:center;">
					<p:messages id="messages" showDetail="true"></p:messages>
				</h:panelGrid>

				<h:panelGrid columns="2" id="panelAdd">

					<h:panelGrid>

						<h:panelGrid columns="4">

							<p:outputLabel value="Documento de identidad"></p:outputLabel>

							<p:inputText id="userDocumentNumber"
								value="#{recruiterController.documentNumberSearch}"></p:inputText>
							<p:commandButton
								actionListener="#{recruiterController.searchPersonByDocumentNumber}"
								value="Buscar" process="@this :formAdd:userDocumentNumber"
								update=":formAdd:usersTable :formAdd:userId  :formAdd:messages">
							</p:commandButton>

							<p:outputLabel id="userId"
								value="Usuario seleccionado: #{recruiterController.candidateSelected!=null?interviewController.candidateSelected.id:''}">
							</p:outputLabel>

						</h:panelGrid>



					</h:panelGrid>
					<h:panelGrid columns="2">

						<p:outputLabel value="Username"></p:outputLabel>
						<p:inputText value="#{recruiterController.username}" required="true"
							requiredMessage="Debe ingresar Username"></p:inputText>

						<p:outputLabel value="Password"></p:outputLabel>
						<p:inputText value="#{recruiterController.password}" required="true"
							requiredMessage="Debe ingresar Password"></p:inputText>

						<p:outputLabel value="¿Activo?"></p:outputLabel>
						<p:selectOneMenu value="#{recruiterController.isActive}"
							required="true" requiredMessage="Debe seleccionar ¿Activo?">
							<f:selectItem itemLabel="Seleccione.." itemValue="" />
							<f:selectItem itemValue="true" itemLabel="Si"></f:selectItem>
							<f:selectItem itemValue="false" itemLabel="No"></f:selectItem>
						</p:selectOneMenu>
					</h:panelGrid>
					<h:panelGrid>
						<p:outputLabel value="Seleccione permisos"></p:outputLabel>

						<p:pickList value="#{recruiterController.permissions}" var="permission"
							itemLabel="#{permission.substring(permission.indexOf(124)+1,permission.length())}"
							itemValue="#{permission}">
							<f:facet name="sourceCaption">Disponibles</f:facet>
							<f:facet name="targetCaption">Seleccionados</f:facet>
						</p:pickList>
					</h:panelGrid>
					<h:panelGrid>

						<p:outputLabel value="Seleccione departamentos disponibles"></p:outputLabel>
						<p:pickList value="#{recruiterController.departmentsAvailable}"
							var="department"
							itemLabel="#{department.substring(department.indexOf(124)+1,department.length())}"
							itemValue="#{department}">
							<f:facet name="sourceCaption">Disponibles</f:facet>
							<f:facet name="targetCaption">Seleccionados</f:facet>
						</p:pickList>
					</h:panelGrid>
				</h:panelGrid>

				<h:panelGrid style="margin:auto;text-align:center;">
					<p:commandButton action="#{recruiterController.addUser}" value="Agregar"
						ajax="false">
					</p:commandButton>
				</h:panelGrid>
			</h:panelGrid>
		</h:form>
	</ui:define>

</ui:composition>
</html>
